@extends('admin.layout.layout', ['row' => @$page])

@section('contain')


    <div class="portlet">
        <div class="portlet-title">
            <div class="caption">
                <x-portlet-breadcrumb :page="$page"></x-portlet-breadcrumb>
            </div>
            <div class="actions">
                {{--<div class="item">
                    <a href="/{{ request()->path() }}/create" class="btn btn-sm btn-primary">{{ ts('addnew') }}</a>
                </div>--}}
            </div>
        </div>
        {{--<x-upload-box name="sfasdf"></x-upload-box>--}}
        <form action="/{{ request()->path() }}/../" method="post" onsubmit="return checkVal(this)" class="warranty-form" target="_blank">
            @csrf
            <input type="text" name="_previous_" value="{{ request()->header('referer') }}" hidden>
            <h3 class="section_sub_title">{{ ts('CUSTOMER') }}</h3>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('CUSTOMERNAME') }}</div>
                <div class="form-input">
                    <div class="input-group custom-control-inline">
                        <input type="text" name="first_name" value="{{ $data->first_name ?: old('first_name') }}" class="form-control">
                    </div>
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('addresss') }}</div>
                <div class="form-input">
                    <div class="input-group custom-control-inline">
                        <input type="text" name="addresss" value="{{ $data->password ?: old('addresss') }}" class="form-control">
                    </div>
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('region') }}</div>
                <div class="form-input">
                    <select name="region_id" id="" class="form-control region_json" data-value="{{ $data->region_id ?: old('region_id') }}" required>
                        <option value="">{{ ts('select') }}</option>
                        <option value="{{ $data->region_id }}" selected>{{ ts('region_master.'.$data->region_id) }}</option>
                    </select>
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('province') }}</div>
                <div class="form-input">
                    <select name="province_id" id="" class="form-control province_json" data-value="{{ $data->province_id ?: old('province_id') }}" required>
                        <option value="">{{ ts('select') }}</option>
                        <option value="{{ $data->province_id }}" selected>{{ ts('province_master.'.$data->province_id) }}</option>
                    </select>
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('city') }}</div>
                <div class="form-input">
                    <select name="city" id="" class="form-control city_json" data-value="{{ $data->city ?: old('city') }}" required>
                        <option value="">{{ ts('select') }}</option>
                        <option value="{{ $data->city }}" selected>{{ ts('cities.'.$data->city) }}</option>
                    </select>
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('zip') }}</div>
                <div class="form-input">
                    <input type="text" name="zip" value="{{ $data->zip ?: old('zip') }}" class="form-control">
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('email') }}</div>
                <div class="form-input">
                    <input type="email" name="email_address" value="{{ $data->email_address ?: old('email_address') }}" class="form-control">
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('phonenumber') }}</div>
                <div class="form-input">
                    <div class=" input-group custom-control-inline">
                        <div class="input-group-prepend">
                            <select name="extension" class="form-control">
                                @foreach(\App\Models\PhoneExtension::get(['id', 'phone_ext']) as $v)
                                    <option value="{{ $v->phone_ext }}" {{ ($data->extension == $v->phone_ext || old('phone_number')==$v->phone_ext ) ? 'selected' : '' }}>{{ $v->phone_ext }}</option>
                                @endforeach
                            </select>
                        </div>
                        <input type="number" name="phone_number" value="{{ $data->phone_number ?: old('phone_number') }}" class="form-control" required>
                    </div>
                </div>
            </div>
            <h3 class="section_sub_title">{{ ts('VEHICLEINFORMATION') }}</h3>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('year') }}</div>
                <div class="form-input">
                    <select name="year_id" id="" class="form-control make_json_year" data-value="{{ $data->year_id ?: old('year_id') }}" required>
                        <option value="">{{ ts('select') }}</option>
                        <option value="{{ $data->year_id }}" selected>{{ $data->year_id }}</option>
                    </select>
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('make') }}</div>
                <div class="form-input">
                    <select name="make_id" id="" class="form-control make_json_make" data-value="{{ $data->make_id ?: old('make_id') }}" required>
                        <option value="">{{ ts('select') }}</option>
                        <option value="{{ $data->make_id }}" selected>{{ ts('make_master.'.$data->make_id) }}</option>
                    </select>
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('model') }}</div>
                <div class="form-input">
                    <input type="text" name="model_id" value="{{ $data->model_id ?: old('model_id') }}" class="form-control" >
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('licenseplate') }}</div>
                <div class="form-input">
                    <input type="text" name="license_plate" value="{{ $data->license_plate ?: old('license_plate') }}" class="form-control" >
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('vinnumber') }}</div>
                <div class="form-input">
                    <input type="text" name="vin_number" value="{{ $data->vin_number ?: old('vin_number') }}" class="form-control" >
                </div>
            </div>
            <h3 class="section_sub_title">{{ ts('INSTALLATIONINFORMATION') }}</h3>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('INSTALLERNAME') }}</div>
                <div class="form-input">
                    <input type="text" name="installer_name" value="{{ $data->installer_name ?: old('installer_name') }}" class="form-control" >
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('INSTALLATIONDATE') }}</div>
                <div class="form-input">
                    <input type="text" name="installation_date" value="{{ $data->installation_date ?: old('installation_date') }}" class="form-control" >
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('INSTALLERPRICE') }}</div>
                <div class="form-input">
                    <input type="text" name="installation_price" value="{{ $data->installation_price ?: old('installation_price') }}" class="form-control" >
                </div>
            </div>
            <h3 class="section_sub_title">{{ ts('INSTALLATIONPICTURE') }}</h3>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('FRONT') }}</div>
                <div class="form-input">
                    <x-upload-box name="image_front" value="{{ $data->image_front  ?: old('image_front ')}}"></x-upload-box>
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('BACK') }}</div>
                <div class="form-input">
                    <x-upload-box name="image_back" value="{{ $data->image_back  ?: old('image_back ')}}"></x-upload-box>
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('DRIVERSIDE') }}</div>
                <div class="form-input">
                    <x-upload-box name="image_driver_side" value="{{ $data->image_driver_side  ?: old('image_driver_side ')}}"></x-upload-box>
                </div>
            </div>
            <div class="form-item form-s1">
                <div class="form-label" required="">{{ ts('PASSENGERSIDE') }}</div>
                <div class="form-input">
                    <x-upload-box name="image_passenger_side" value="{{ $data->image_passenger_side  ?: old('image_passenger_side ')}}"></x-upload-box>
                </div>
            </div>
            <h3 class="section_sub_title">{{ ts('VEHICLECOVERAGE') }}</h3>
            @include('admin.subview.warranty_coverage', ['coverages2' => $data->warranty_to_vehicle_coverage])
            <h3 class="section_sub_title">{{ ts('note') }}</h3>
            <div class="mt-3">
                <textarea name="additional_comments" id="" class="form-control">{{ @$data->additional_comments ?: old('additional_comments') }}</textarea>
            </div>
            <div class="mt-4">
                <button class="btn btn-info">{{ ts('store') }}</button>
            </div>
        </form>

    </div>


@endsection